<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use \dmstr\bootstrap\Tabs;
use yii\helpers\StringHelper;
use \trntv\filekit\widget\Upload;
/**
* @var yii\web\View $this
* @var yiike\goods\model\GoodsCategory $model
* @var yii\widgets\ActiveForm $form
*/

?>

<div class="goods-category-form">

    <?php $form = ActiveForm::begin([
    'id' => 'GoodsCategory',
    'layout' => 'horizontal',
    'enableClientValidation' => true,
    'errorSummaryCssClass' => 'error-summary alert alert-danger',
    'fieldConfig' => [
             'template' => "{label}\n{beginWrapper}\n{input}\n{hint}\n{error}\n{endWrapper}",
             'horizontalCssClasses' => [
                 'label' => 'col-sm-2',
                 #'offset' => 'col-sm-offset-4',
                 'wrapper' => 'col-sm-8',
                 'error' => '',
                 'hint' => '',
             ],
         ],
    ]
    );
    ?>

    <div class="">
        <?php $this->beginBlock('main'); ?>

        <p>

            <!-- attribute parentid -->
            <?php if($category){?>
        <div class="form-group field-ttyccategory-name required has-error">
            <label class="control-label col-sm-2" for="ttyccategory-name">上级分类</label>
            <div class="col-sm-8">
                <input type="text" class="form-control"  disabled="true" value="<?php echo $category; ?>" maxlength="50" aria-required="true" aria-invalid="true">
            </div>
        </div>
    <?php } ?>

        <!-- attribute name -->
        <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
        <?=
        $form->field($model, 'logo_file')->label('图标')->widget(
            Upload::className(), [
                'url'              => ['/files/upload'],
                'sortable'         => true,
                'maxFileSize'      => 10000000, // 10 MiB
                'maxNumberOfFiles' => 1,

            ]
        );
        ?>

        <?=
        $form->field($model, 'banner_file')->label('广告图')->widget(
            Upload::className(), [
                'url'              => ['/files/upload'],
                'sortable'         => true,
                'maxFileSize'      => 10000000, // 10 MiB
                'maxNumberOfFiles' => 1,

            ]
        );
        ?>
        <!-- attribute displayorder -->
        <?= $form->field($model, 'orderby')->textInput() ?>

        <?= $form->field($model, 'status')->radioList(['0'=>'否','1'=>'是'],['class'=>'label-group'])->label('是否显示'); ?>

        </p>
        <?php $this->endBlock(); ?>
        
        <?=
    Tabs::widget(
                 [
                    'encodeLabels' => false,
                    'items' => [ 
                        [
    'label'   => Yii::t('models', '商品分类'),
    'content' => $this->blocks['main'],
    'active'  => true,
],
                    ]
                 ]
    );
    ?>
        <hr/>

        <?php echo $form->errorSummary($model); ?>

        <?= Html::submitButton(
        '<span class="glyphicon glyphicon-check"></span> ' .
        ($model->isNewRecord ? '添加' : '保存'),
        [
        'id' => 'save-' . $model->formName(),
        'class' => 'btn btn-success'
        ]
        );
        ?>

        <?php ActiveForm::end(); ?>

    </div>

</div>

